package com.example.home_app.adapter

import android.annotation.SuppressLint
import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.home_app.R
import com.example.home_app.data.DataServer
import com.example.home_app.util.SbParameter
import com.example.home_app.util.Status
import java.util.*

/**
 * Created by dell on 2021/8/10.
 */


/**DataServer
 * 文 件 名: DriveKinectAdapter
 * 创 建 人: Allen
 * 创建日期: 16/12/24 15:33
 * 邮   箱: AllenCoder@126.com
 * 修改时间：
 * 修改备注：
 */

open class DriveKinectAdapter(var list: ArrayList<Map<String, Any>>) :
    BaseQuickAdapter<Status, BaseViewHolder>(
        R.layout.simple_adapter_item,
        DataServer.getSampleData(SbParameter.KitchenSUM)
    ) {
    @SuppressLint("ResourceType")
    override fun convert(holder: BaseViewHolder, item: Status) {
        holder.setText(R.id.sai_id, list[holder.layoutPosition]["id"].toString())
        holder.setText(R.id.sai_name, list[holder.layoutPosition]["name"].toString())
        holder.setText(R.id.sai_phone, list[holder.layoutPosition]["online"].toString())

        if (list[holder.layoutPosition]["online"].toString() === "true") {
            holder.setTextColor(R.id.sai_phone,Color.GREEN)
        } else {
            holder.setTextColor(R.id.sai_phone,Color.RED)
        }
    }




}